package com.ktjiaoyu.crm.service;

import com.ktjiaoyu.crm.mapper.RightMapper;
import com.ktjiaoyu.crm.pojo.Right;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

@Service("rightService")
public class RightServiceImpl implements RightService {

    @Autowired
    private RightMapper rightMapper;

    /**
     * 根据角色ID查询角色所拥有权限
     * @param roleId
     * @return
     */
    @Override
    public Set<String> findRightsByRoleId(Long roleId) {

        return rightMapper.findRightsByRoleId(roleId);
    }

    @Override
    public List<Right> findAllRights() {

        return rightMapper.selectList(null);
    }

    @Override
    public List<Right> getRightsByRoleId(Long roleId) {

        return rightMapper.getRightsByRoleId(roleId);
    }
}
